package cn.aspect.enums;

import cn.hutool.core.util.DesensitizedUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.function.Function;

@Getter
@AllArgsConstructor
public enum DESENSITIZATION_TYPE {
    ID_CARD("idCard", "身份证", (idCard) -> DesensitizedUtil.idCardNum(idCard, 2, 2)),
    MOBILE("mobile", "手机号", (mobile) -> DesensitizedUtil.mobilePhone(mobile)),
    NICK_NAME("name", "姓名", (name) -> DesensitizedUtil.chineseName(name)),
    BANK_CARD("bankCard", "银行卡号", (bankCard) -> DesensitizedUtil.bankCard(bankCard)),
    ADDRESS("address", "地址", (address) -> DesensitizedUtil.address(address, 2)),
    EMAIL("email", "邮箱", (email) -> DesensitizedUtil.email(email)),
    NONE("none", "不脱敏", null);
    private String code;
    private String desc;
    private Function<String, String> apply;
}
